These issues are all within test code, i.e. should not affect users.
https://github.com/statsmodels/statsmodels/commit/
bb8fba9d4d9883be2991b43b29bfa3a9c3fb325a
https://github.com/statsmodels/statsmodels/commit/
310f91da9f07d9483965d624d76dbb7abebbd67f
https://github.com/statsmodels/statsmodels/pull/4911/commits/
18dcceefbfed61b0d11ae5884a9f4cea82c2edb5
https://github.com/statsmodels/statsmodels/commit/
f1d5eddd44d61099a9f8f90c40c35716a8346cf7
and one new fix only needed on 32 bit Python 2 (integer data loads as
int64, which gets converted to long producing factor names like
C(agecat)[T.4L], which does not match C(agecat)[T.4])
Author: Kevin "bashtage" Sheppard, Peter "thequackdaddy" Quackenbush, Matthew Brett, Rebecca N. Palmer <rebecca_palmer@zoho.com>
Origin: upstream (mostly)
Forwarded: no
Gbp-Pq: Name test_fixes.patch
data = pd.read_csv(StringIO(ss), delimiter='\t')
data['logpyears'] = np.log(data['pyears'])
-
+data['agecat'] = data['agecat'].astype(int) # avoid int vs long test failure on 32 bit Python 2
class CheckPoissonConstrainedMixin(object):
import numpy.testing as npt
from statsmodels.tools.testing import assert_equal
-from numpy.testing.utils import WarningManager
longley_formula = 'TOTEMP ~ GNPDEFL + GNP + UNEMP + ARMED + POP + YEAR'
def test_summary(self):
# smoke test
- warn_ctx = WarningManager()
- warn_ctx.__enter__()
- try:
+ with warnings.catch_warnings():
warnings.filterwarnings("ignore",
"kurtosistest only valid for n>=20")
self.model.fit().summary()
- finally:
- warn_ctx.__exit__()
class TestFormulaPandas(CheckFormulaOLS):
from statsmodels.datasets import macrodata
-from statsmodels.compat.pandas import version as pandas_version
-pandas_old = pandas_version < '0.9'
-
# Test precisions
DECIMAL_4 = 4
DECIMAL_3 = 3
# make sure to test with characters outside the latin-1 encoding
pass
-@dec.skipif(pandas_old)
def test_genfromdta_datetime():
results = [(datetime(2006, 11, 19, 23, 13, 20), 1479596223000,
datetime(2010, 1, 20), datetime(2010, 1, 8), datetime(2010, 1, 1),
assert_equal(_datetime_to_stata_elapsed(
_stata_elapsed_date_to_datetime(i, "ty"), "ty"), i)
-@dec.skipif(pandas_old)
def test_datetime_roundtrip():
dta = np.array([(1, datetime(2010, 1, 1), 2),
(2, datetime(2010, 2, 1), 3),
# added it as test method to TestKDEGauss below
# inDomain is not vectorized
#kde_vals = self.res1.evaluate(self.res1.support)
- kde_vals = [self.res1.evaluate(xi) for xi in self.res1.support]
+ kde_vals = [np.squeeze(self.res1.evaluate(xi)) for xi in self.res1.support]
kde_vals = np.squeeze(kde_vals) #kde_vals is a "column_list"
mask_valid = np.isfinite(kde_vals)
# TODO: nans at the boundaries
def test_compare(self):
xx = self.res1.support
- kde_vals = [self.res1.evaluate(xi) for xi in xx]
+ kde_vals = [np.squeeze(self.res1.evaluate(xi)) for xi in xx]
kde_vals = np.squeeze(kde_vals) #kde_vals is a "column_list"
mask_valid = np.isfinite(kde_vals)
# TODO: nans at the boundaries
mod.filter([])
# Example : pandas.Series, string datatype
- endog = pd.Series(['a'], index=dates)
+ endog = pd.Series(['a', 'b'], index=dates)
# raises error due to direct type casting check in Statsmodels base classes
assert_raises(ValueError, check_endog, endog, **kwargs)
state_shocks)
# ARMA(1,1): phi = [0.1], theta = [0.5], sigma^2 = 2
- phi = np.r_[0.1]
- theta = np.r_[0.5]
+ phi = 0.1
+ theta = 0.5
mod = sarimax.SARIMAX([0], order=(1,0,1))
mod.update(np.r_[phi, theta, sigma2])
cov = np.eye(unconstrained.shape[0])
constrained, _ = tools.constrain_stationary_multivariate(unconstrained, cov)
companion = tools.companion_matrix(
- [1] + [-constrained[i] for i in range(len(constrained))]
+ [1] + [-np.squeeze(constrained[i]) for i in range(len(constrained))]
).T
assert_equal(np.max(np.abs(np.linalg.eigvals(companion))) < 1, True)